package com.ztman.router.common.base;

import com.ztman.router.common.dagger.component.ActivityComponent;
import com.ztman.router.common.dagger.component.DaggerActivityComponent;
import com.ztman.router.common.dagger.module.ActivityModule;
import com.ztman.router.common.presenter.base.AbstractPresenter;

import javax.inject.Inject;

/**
 * @Title:BaseActivity
 * @Package:com.ztman.router.common.base
 * @Description: Activity 基类
 * @Auther:YJH
 * @Email:yuannunhua@gmail.com
 * @Date:2018/5/917:46
 */
public abstract class BaseActivity <T extends AbstractPresenter> extends AbstractGrandFatherActivity implements BaseView{

    @Inject
    protected T mPresenter;


    @Override
    protected void onViewCreated() {
        super.onViewCreated();
        initInject();

        if(null != mPresenter){
            mPresenter.attachView(this);
        }
    }

    protected ActivityComponent getActivityComponent() {
        return DaggerActivityComponent.builder()
                .appComponent(MyApplication.getAppComponent())
                .activityModule(new ActivityModule(this))
                .build();

    }



    @Override
    public void showErrorMsg(String errorMessage) {

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void showloadOver() {

    }

    @Override
    public void loadData() {

    }

    @Override
    public void refreshData() {

    }

    @Override
    public void showError() {

    }

    @Override
    public void showSuccess() {

    }

    @Override
    public void showRequestComplete() {

    }

    @Override
    public void showRequestSuccess() {

    }

    @Override
    public void showRequestFail() {

    }

    @Override
    public void showRequestTimeOut() {

    }




    /**
     * 功能：注入当前Activity所需的依赖
     */
    protected abstract void initInject();
}
